package com.sxbbc.common.core.enums;

import com.sxbbc.common.basics.utils.calculation.CalcuUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 商品状态 商品审核状态 枚举类
 * @author leehao
 * @date 2019-05-31
 */
public enum ProductStatusEnums {
    SHELVES(1,"上架"),
    UNSHELVES(2,"下架"),
    DELETE(3,"删除"),
    HAS_CHECK(1,"已审核"),
    NO_CHECK(0,"未审核");

    private Integer id;
    private String name;

    ProductStatusEnums(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static List<ProductStatusEnums> queryList(){
        List<ProductStatusEnums> list=new ArrayList<ProductStatusEnums>();
        for(ProductStatusEnums o: ProductStatusEnums.values()){
            list.add(o);
        }
        return list;
    }

    public static String getName(Integer id){
        String str="";
        for(ProductStatusEnums o: ProductStatusEnums.values()){
            if(CalcuUtils.getInstance().isEquals(id, o.getId())){
                str= o.getName();
                break;
            }
        }
        return str;
    }
}
